home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_494 / vscreen / source / vscreen.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  5KB  |  159 lines

  1. /*
  2.  *  VSCREEN.C       Creates virtual screens that can be larger than
  3.  *                  the actual display area of your monitor.  The virtual
  4.  *                  screen scrolls when the mouse moves off the edge of
  5.  *                  the display.
  6.  *
  7.  *                  Copyright 1988 by Davide P. Cervone, all rights reserved.
  8.  *
  9.  *                  You may may distibute this code as is, for non-commercial
  10.  *                  purposes, provided that this notice remains intact and the
  11.  *                  documentation file is distributed with it.
  12.  *
  13.  *                  You may not modify this code or incorporate it into your
  14.  *                  own programs without the permission of the author.
  15.  */
  16.  
  17. /*
  18.  *  WARNING:  This code uses and even modifies the INTUITIONPRIVATE
  19.  *  area of the IntuitionBase structure.  Use it at your own risk.  It is
  20.  *  likely to break under a future release of Intuition.
  21.  */
  22.  
  23. #define INTUITIONPRIVATE
  24.  
  25. #include <exec/types.h>
  26. #include <exec/semaphores.h>
  27. #include <exec/interrupts.h>
  28. #include <exec/memory.h>
  29. #include <devices/input.h>
  30. #include <graphics/sprite.h>
  31. #include <intuition/intuition.h>
  32. #include <intuition/intuitionbase.h>
  33. #include <intuition/screens.h>
  34. #include <libraries/dos.h>
  35. #ifndef MANX
  36.    #ifdef PROTO
  37.       #include <proto/intuition.h>
  38.       #include <proto/exec.h>
  39.       #include <proto/graphics.h>
  40.       #include <proto/layers.h>
  41.       #include <proto/dos.h>
  42.    #endif
  43. #endif
  44.  
  45.  
  46. #define USAGE       "VSCREEN width height [screen]"
  47. #define COPYRIGHT   "Copyright 1988 by Davide P. Cervone, all rights reserved"
  48.  
  49. #define PORTNAME    "vScreenPort"
  50.  
  51.  
  52. #define INTUITION_REV   0L
  53. #define GRAPHICS_REV    0L
  54. #define LAYERS_REV      0L
  55.  
  56. #define ERROR_EXIT      RETURN_ERROR
  57. #define OK_EXIT         RETURN_OK
  58.  
  59. extern struct IntuitionBase *IntuitionBase;
  60. extern struct GfxBase *GfxBase;
  61. #ifndef PROTO
  62. extern struct DOSBase *DOSBase;
  63. #endif
  64.  
  65.  
  66. /*
  67.  *  This structure is used to pass information from the Handler to the
  68.  *  loader.  It contins pointers to the variables that the loader will
  69.  *  have to initialize, and to the routines that it has to call, or 
  70.  *  SetFunction into the libraries.  A pointer to this structure is
  71.  *  stored in the MsgPort so that the loader can find and remove the handler
  72.  *  once it's job is done.
  73.  */
  74.  
  75. struct vScreenInfo
  76. {
  77.    short MajVers,MinVers, LoadVers;     /* version of handler and loader */
  78.    char *Program;                       /* name of the handler program */
  79.    char *PortName;                      /* name of the public port */
  80.    long Segment;                        /* SegList loaded by loader */
  81.    struct Interrupt *HandlerInfo;       /* Input.Device handler */
  82.    struct IntuitionBase **IntuitionBase;
  83.    struct GfxBase **GfxBase;
  84.  
  85.    struct Screen **VScreen;             /* the virtual screen */
  86.    SHORT *ScreenWidth,*ScreenHeight;    /* the new width and height */
  87.    SHORT *OldWidth,*OldHeight;          /* old screen size */
  88.    SHORT **RxOffset,**RyOffset;         /* pointer to RasInfo offsets */
  89.    SHORT *RxOffset2,*RyOffset2;         /* normalized offsets */
  90.    LONG  *LaceScreen,*LaceShift;        /* LACE screen? */
  91.    LONG  *HiResScreen,*HiResShift;      /* HIRES screen ? */
  92.    WORD  *OldMaxDH,*OldMaxDR,*OldMaxDW; /* old IntuitionBase MaxDisplays */
  93.    
  94.    /*
  95.     *  These routines are called by the loader:
  96.     */
  97.  
  98.    void (*SetVScreen)();
  99.    void (*ResetVScreen)();
  100.    void (*FixView)();
  101.    
  102.    /*
  103.     *  These routines replace the Intution and Graphics library routines:
  104.     */
  105.    
  106.    void (*aCloseScreen)();
  107.    void (*aBuildSysRequest)();
  108.    void (*aAutoRequest)();
  109.    void (*aLoadView)();
  110.    void (*aMoveSprite)();
  111.    
  112.    /*
  113.     *  These are the addresses of the JSR or JMP instructions that
  114.     *  need to be changed to call the old library vectors:
  115.     */
  116.  
  117.    long *CloseScreenJmpTarget;
  118.    long *BuildSysRequestJmpTarget;
  119.    long *AutoRequestJmpTarget;
  120.    long *LoadViewJmpTarget;
  121.    long *MoveSpriteJmpTarget;
  122.    
  123.    /*
  124.     *  These are the old function vectors returned by SetFunction(): 
  125.     */
  126.   
  127.    long OldCloseScreen;
  128.    long OldBuildSysRequest;
  129.    long OldAutoRequest;
  130.    long OldLoadView;
  131.    long OldMoveSprite;
  132. };
  133.  
  134.  
  135. /*
  136.  *  These macros give easy access to the vScreenInfo structure:
  137.  */
  138.  
  139. #define VAR(x)      (*(vScreenData->x))
  140. #define var(x)      (vScreenData->x)
  141.  
  142.  
  143. /*
  144.  *  External routine declarations:
  145.  */
  146.  
  147. #ifndef PROTO
  148. extern struct Window *OpenWindow();
  149. extern struct IntuiMessage *GetMsg();
  150. extern APTR OpenLibrary();
  151. extern PLANEPTR AllocRaster();
  152. extern UBYTE *AllocMem();
  153. extern struct MsgPort *CreatePort();
  154. extern struct IOStdReq *CreateStdIO();
  155. extern LONG OpenDevice();
  156. extern struct MsgPort *FindPort();
  157. extern long LoadSeg();
  158. #endif
  159.